
#include <iostream>
#include <range/v3/range.hpp>
#include <range/v3/range/conversion.hpp>
#include <range/v3/view/filter.hpp>
#include <range/v3/view/take.hpp>
#include <range/v3/view/transform.hpp>
#include <string>
#include <vector>

#include "common/person.h"

using namespace ranges::views;

int main()
{
    std::vector<person_t> people {
        { "David", person_t::male },
        { "Jane", person_t::female },
        { "Martha", person_t::female },
        { "Peter", person_t::male },
        { "Rose", person_t::female },
        { "Tom", person_t::male }
    };

    std::vector<std::string> names = people
        | filter([](const person_t& p) {
              return p.gender() == person_t::female;
          })
        | transform([](const person_t& p) {
              return p.name();
          })
        | take(2)
        | ranges::to<std::vector>();

    for (auto name : names) {
        std::cout << name << std::endl;
    }
}